<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleleaf.org">
<head th:insert="base">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <blockquote class="layui-elem-quote">欢迎<span>管理员</span>：
                        <span class="x-red" id="userName"></span>！
                    </blockquote>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">数据统计</div>
                <div class="layui-card-body ">
                    <ul class="layui-row layui-col-space10 layui-this x-admin-carousel x-admin-backlog">
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>管理员数</h3>
                                <p>
                                    <cite th:text="${adminNum}"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>用户数</h3>
                                <p>
                                    <cite th:text="${userNum}"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>待发布新闻数</h3>
                                <p>
                                    <cite th:text="${sysNewsNum}"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>正在拍卖拍品数</h3>
                                <p>
                                    <cite th:text="${bidGoodNum}"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6 ">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>订单数</h3>
                                <p>
                                    <cite th:text="${orderNum}"></cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a href="javascript:;" class="x-admin-backlog-body">
                                <h3>待处理投诉数</h3>
                                <p>
                                    <cite th:text="${toHandleNum}"></cite></p>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">公告通知</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody id ="sysNews">
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">开发团队</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <th>开发单位</th>
                            <td id="devUnit"></td>
                        </tr>
                        <tr>
                            <th>运营单位</th>
                            <td id="operUnit"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <blockquote class="layui-elem-quote layui-quote-nm" id="footText"></blockquote></div>
    </div>
</div>
<script th:inline="javascript">
    layui.use(['util'], function(){
        var util = layui.util;
        var adminInfo = [[${adminInfo}]];
        $("#userName").html(adminInfo.userName);
        $("#devUnit").html(devUnit);
        $("#operUnit").html(operUnit);
        $("#footText").html(footText);

        //获取公告
        $.ajax({
            url:'/back/news/getAllList'
            ,type:'post'
            ,data:{
                newsType:'1'
            }
            ,async:false
            ,dataType:'json'
            ,success:function(res){
                if (res.code === return_200) {
                    $("#sysNews").empty();
                    var newsHtml = "";
                    for (var i = 0; i < res.data.length; i++) {
                        newsHtml += "<tr>\n" +
                        "<th>"+res.data[i].newsTitle+"</th>\n" +
                        "<td style=\"color: green;\"><a onclick=\"xadmin.open\('查看公告','/back/news/preview?id="+res.data[i].id+"'\)\">"+res.data[i].newsOutline+"</a></td></tr>";
                    }
                    $("#sysNews").append(newsHtml)
                } else {
                    console.log("获取公告失败");
                }
            }
            ,error:function(){
                console.log("获取公告异常");
            }
        });
    });
</script>
</body>
</html>